<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="外协明细一览表" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillList.css" />
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function checkDateStr(){
		var startDate=document.getElementById("start_date").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择外协开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','外协开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','外协开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("end_date").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择外协结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','外协结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','外协结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function checkGathDate(){
		var startDate=document.getElementById("gath_start").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择交货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("gath_end").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择交货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function createPageParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("end_date").value);
		str=str+"&gath_start="+encodeURIComponent(document.getElementById("gath_start").value);
		str=str+"&gath_end="+encodeURIComponent(document.getElementById("gath_end").value);
		
		var examined="A";
		if(document.getElementById("examine1").checked){
			examined="Y";
		}else if(document.getElementById("examine2").checked){
			examined="N";
		}
		str=str+"&examined="+examined;
		
		var gathered="A";
		if(document.getElementById("gather1").checked){
			gathered="Y";
		}else if(document.getElementById("gather2").checked){
			gathered="P";
		}else if(document.getElementById("gather3").checked){
			gathered="N";
		}
		str=str+"&gathered="+gathered;
		
		var paied="A";
		if(document.getElementById("paied1").checked){
			paied="Y";
		}else if(document.getElementById("paied2").checked){
			paied="N";
		}
		str=str+"&paied="+paied;
		
		str=str+"&manager_name="+encodeURIComponent(document.getElementById("manager_name").value);
		str=str+"&lm="+encodeURIComponent(document.getElementById("lm").value);
		str=str+"&phon="+encodeURIComponent(document.getElementById("phon").value);
		str=str+"&prod="+encodeURIComponent(document.getElementById("prod").value);
		str=str+"&dep="+document.getElementById("dep").value;
		str=str+"&creater_name="+encodeURIComponent(document.getElementById("creater_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("est_name").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("bill_code").value);
		str=str+"&coo_cont="+encodeURIComponent(document.getElementById("coo_cont").value);
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("bb_code").value);
		str=str+"&make_type="+document.getElementById("make_type").value;
		str=str+"&content="+encodeURIComponent(document.getElementById("content").value);
		str=str+"&require="+encodeURIComponent(document.getElementById("require").value);
		str=str+"&ts_id="+document.getElementById("ts_id").value;
		str=str+"&order_by="+document.getElementById("order_by").value;
		str=str+"&order_sc="+document.getElementById("order_sc").value;
		
		return str;
	}
	
	function createProgramParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("hid_start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("hid_end_date").value);
		str=str+"&gath_start="+encodeURIComponent(document.getElementById("hid_gath_start").value);
		str=str+"&gath_end="+encodeURIComponent(document.getElementById("hid_gath_end").value);
		str=str+"&examined=${examined}";
		str=str+"&gathered=${gathered}";
		str=str+"&paied=${paied}";
		str=str+"&manager_name="+encodeURIComponent(document.getElementById("hid_manager_name").value);
		str=str+"&lm="+encodeURIComponent(document.getElementById("hid_lm").value);
		str=str+"&phon="+encodeURIComponent(document.getElementById("hid_phon").value);
		str=str+"&prod="+encodeURIComponent(document.getElementById("hid_prod").value);
		str=str+"&dep=${dep}";
		str=str+"&creater_name="+encodeURIComponent(document.getElementById("hid_creater_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("hid_est_name").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("hid_bill_code").value);
		str=str+"&coo_cont="+encodeURIComponent(document.getElementById("hid_coo_cont").value);
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("hid_bb_code").value);
		str=str+"&make_type=${makeType}";
		str=str+"&content="+encodeURIComponent(document.getElementById("hid_content").value);
		str=str+"&require="+encodeURIComponent(document.getElementById("hid_require").value);
		str=str+"&ts_id=${tsId}";
		str=str+"&order_by=${orderBy}";
		str=str+"&order_sc=${orderSc}";
		
		return str;
	}
	function doSearch(){
		var str;
		if(IsAdvSearch){//高级
			str="search_type=1";
			if(document.getElementById("cb_cooper_date").checked){
				if(checkDateStr()){
					str=str+"&cb_cooper_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_gath_date").checked){
				if(checkGathDate()){
					str=str+"&cb_gath_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_examine").checked){
				str=str+"&cb_examine=1";
			}
			if(document.getElementById("cb_gather").checked){
				str=str+"&cb_gather=1";
			}
			
			if(document.getElementById("cb_pay").checked){
				str=str+"&cb_pay=1";
			}
			if(document.getElementById("cb_manager").checked){
				var managerName=document.getElementById("manager_name").value.trim();
				if(managerName==null || managerName==""){
					ShowAlert('提示框','请输入业务员姓名',200,100);
					return;
				}
				str=str+"&cb_manager=1";
			}
			if(document.getElementById("cb_lm").checked){
				var lm=document.getElementById("lm").value.trim();
				if(lm==null || lm==""){
					ShowAlert('提示框','请输入联系人',200,100);
					return;
				}
				str=str+"&cb_lm=1";
			}
			if(document.getElementById("cb_phon").checked){
				var phon=document.getElementById("phon").value.trim();
				if(phon==null || phon==""){
					ShowAlert('提示框','请输入电话',200,100);
					return;
				}
				str=str+"&cb_phon=1";
			}
			if(document.getElementById("cb_prod").checked){
				var prod=document.getElementById("prod").value.trim();
				if(prod==null || prod==""){
					ShowAlert('提示框','请输入材质',200,100);
					return;
				}
				str=str+"&cb_prod=1";
			}
			if(document.getElementById("cb_creater").checked){
				var createrName=document.getElementById("creater_name").value.trim();
				if(createrName==null || createrName==""){
					ShowAlert('提示框','请输入开单人姓名',200,100);
					return;
				}
				str=str+"&cb_creater=1";
			}
			if(document.getElementById("cb_est").checked){
				var estName=document.getElementById("est_name").value.trim();
				if(estName==null || estName==""){
					ShowAlert('提示框','请输入外协单位',200,100);
					return;
				}
				str=str+"&cb_est=1";
			}
			if(document.getElementById("cb_bill_code").checked){
				var billCode=document.getElementById("bill_code").value.trim();
				if(billCode==null || billCode==""){
					ShowAlert('提示框','请输入外协单号',200,100);
					return;
				}
				str=str+"&cb_bill_code=1";
			}
			if(document.getElementById("cb_coo_cont").checked){
				var cooCont=document.getElementById("coo_cont").value.trim();
				if(cooCont==null || cooCont==""){
					ShowAlert('提示框','请输入摘要',200,100);
					return;
				}
				str=str+"&cb_coo_cont=1";
			}
			if(document.getElementById("cb_bb_code").checked){
				var bbCode=document.getElementById("bb_code").value.trim();
				if(bbCode==null || bbCode==""){
					ShowAlert('提示框','请输入业务单号',200,100);
					return;
				}
				str=str+"&cb_bb_code=1";
			}
			if(document.getElementById("cb_make_type").checked){
				var makeType=document.getElementById("make_type").value;
				if(makeType==null || makeType=="" || makeType=="0"){
					ShowAlert('提示框','请选择项目类型',200,100);
					return;
				}
				str=str+"&cb_make_type=1";
			}
			if(document.getElementById("cb_dep").checked){
				var dep=document.getElementById("dep").value;
				if(dep==null || dep=="" || dep=="0"){
					ShowAlert('提示框','请选择部门',200,100);
					return;
				}
				str=str+"&cb_dep=1";
			}
			if(document.getElementById("cb_content").checked){
				var content=document.getElementById("content").value.trim();
				if(content==null || content==""){
					ShowAlert('提示框','请输入内容',200,100);
					return;
				}
				str=str+"&cb_content=1";
			}
			if(document.getElementById("cb_require").checked){
				var require=document.getElementById("require").value.trim();
				if(require==null || require==""){
					ShowAlert('提示框','请输入制作要求',200,100);
					return;
				}
				str=str+"&cb_require=1";
			}
			if(document.getElementById("cb_ts").checked){
				var tsId=document.getElementById("ts_id").value;
				if(tsId==null || tsId=="" || tsId=="0"){
					ShowAlert('提示框','请选择帐套',200,100);
					return;
				}
				str=str+"&cb_ts=1";
			}
			if(document.getElementById("cb_order").checked){
				var orderBy=document.getElementById("order_by").value;
				if(orderBy==null || orderBy==""){
					ShowAlert('提示框','请选择排序类型',200,100);
					return;
				}
				str=str+"&cb_order=1";
			}
		}else{//快速
			str="search_type=2";
			if(!checkDateStr()){
				return;
			}
		}
		var paraStr=createPageParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		window.location="/cooper/CooperBillItemSearchResult.ihtm?"+str;
	}
	function doGo(pageIndex){
		var str=getSearchCondition();
		str=str+"&current_page="+pageIndex;
		window.location="/cooper/CooperBillItemSearchResult.ihtm?"+str;
	}
	function getSearchCondition(){
		var searchType="${searchType}";
		var str="search_type="+searchType;
		if(searchType=="1"){//高级
			<c:if test="${cbCooperDate=='1'}">str=str+"&cb_cooper_date=1";</c:if>
			<c:if test="${cbGathDate=='1'}">str=str+"&cb_gath_date=1";</c:if>
			<c:if test="${cbExamine=='1'}">str=str+"&cb_examine=1";</c:if>
			<c:if test="${cbGather=='1'}">str=str+"&cb_gather=1";</c:if>
			<c:if test="${cbPay=='1'}">str=str+"&cb_pay=1";</c:if>
			<c:if test="${cbManager=='1'}">str=str+"&cb_manager=1";</c:if>
			<c:if test="${cbLm=='1'}">str=str+"&cb_lm=1";</c:if>
			<c:if test="${cbPhon=='1'}">str=str+"&cb_phon=1";</c:if>
			<c:if test="${cbProd=='1'}">str=str+"&cb_prod=1";</c:if>
			<c:if test="${cbDep=='1'}">str=str+"&cb_dep=1";</c:if>
			<c:if test="${cbCreater=='1'}">str=str+"&cb_creater=1";</c:if>
			<c:if test="${cbEst=='1'}">str=str+"&cb_est=1";</c:if>
			<c:if test="${cbBillCode=='1'}">str=str+"&cb_bill_code=1";</c:if>
			<c:if test="${cbCooCont=='1'}">str=str+"&cb_coo_cont=1";</c:if>
			<c:if test="${cbBbCode=='1'}">str=str+"&cb_bb_code=1";</c:if>
			<c:if test="${cbMakeType=='1'}">str=str+"&cb_make_type=1";</c:if>
			<c:if test="${cbContent=='1'}">str=str+"&cb_content=1";</c:if>
			<c:if test="${cbRequire=='1'}">str=str+"&cb_require=1";</c:if>
			<c:if test="${cbTs=='1'}">str=str+"&cb_ts=1";</c:if>
			<c:if test="${cbOrder=='1'}">str=str+"&cb_order=1";</c:if>
		}else{//快速
			
		}
		var paraStr=createProgramParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		return str;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
		if(window.screen.availWidth>1024){
			var w=window.screen.availWidth*0.98;
			window.resizeTo(w,600);
			//居中
			var resizeWinTop=(window.screen.availHeight-600)/2;
			var resizeWinLeft=(window.screen.availWidth-w)/2;
			window.moveTo(resizeWinLeft,resizeWinTop);
		}
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doAutoCheck(objId){
		document.getElementById(objId).checked=true;
	}
	function selectStafferName(objId,checkObjId){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectStafferNameCallBack('"+objId+"','"+checkObjId+"')");
	}
	function selectStafferNameCallBack(objId,checkObjId){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById(objId).value=arr[1];
			doAutoCheck(checkObjId);
		}
	}
	function doDownload(){
		var str=getSearchCondition();
		window.location="/cooper/CooperBillItemSearchResult.ihtm?content_type=EXCEL&"+str;
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="TODAY"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="YESTERDAY"){
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
		doAutoCheck("cb_cooper_date");
	}
	function selectEstName(){
		var url="/base/EstablishmentListForSelect.ihtm?type=COOPERATOR";
		ShowIframe("选择外协商",url,900,500,"selectEstNameCallBack()");
	}
	function selectEstNameCallBack(){
		if(popRetVal!=null){
			document.getElementById("est_name").value=popRetVal[1];
			doAutoCheck("cb_est");
		}
	}
</script>
</head>
<body oncontextmenu="return false">
<div class="Wrap"> <!-- 页面主框架 -->
    
	<div id="ListContainer" class="Container"><!-- 主体容器 -->
	    
	    <!-- 标题栏 -->
	    <div class="Heading BillIcon">
	        <div class="HeadingContent">
	            <h1>外协明细一览表</h1>
	            <span class="Note">查询外协业务的详细清单</span>
	        </div>
	    </div>

		<!-- 主内容 -->
		<div class="Content">
	        <!-- 筛选控件栏 -->
	        <div class="FilterBar ClearFix">
	            <div class="SearchIcon"></div>
	            <span class="fl">
	            	<table class="MoreOption" cellpadding="0" cellspacing="0">
	            		<th class="c1" width="80px">
	            			<input type="checkbox" name="cb_cooper_date" id="cb_cooper_date" <c:if test="${cbCooperDate=='1' || searchType=='2'}">checked="true"</c:if> style="visibility:hidden;" />
	            			外协日期
	            		</th>
	            		<td width="360px">
	            			<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cooper_date');" id="start_date" name="start_date" value="<c:out value="${startDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_cooper_date\')');">
			            	<input type="hidden" id="hid_start_date" value="<c:out value="${startDate}" />">
			            	至
			            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cooper_date');" id="end_date" name="end_date" value="<c:out value="${endDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_cooper_date\')');">
			            	<input type="hidden" id="hid_end_date" value="<c:out value="${endDate}" />">
			            	<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
							<a href="javascript:setDate('TODAY');">今天</a>
							<a href="javascript:setDate('YESTERDAY');">昨天</a>
							<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
	            		</td>
	            	</table>
	            </span>
	            <span class="fr">
	            	<a href="javascript:;" id="lnkMoreOption">更多查询选项</a>
		  			<input type="button" value=" 查 询" onClick="doSearch();" class="buttom search-but" id="sSearchButton" name="sSearchButton">
	                <input type="button" value=" 导 出" onClick="doDownload();" class="buttom search-out" id="sDownloadButton" name="sDownloadButton" <c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_EXPO;')!=-1}">disabled="true"</c:if>>
	            </span>
				<div id="dvMoreOptionBox" class="MoreOptionBox" style="display:none;">
					<table class="MoreOption" cellpadding="0" cellspacing="0">
						<tr>
							<th class="c1" width="80px">
	                        	<input type="checkbox" name="cb_gath_date" id="cb_gath_date" <c:if test="${cbGathDate=='1'}">checked="true"</c:if>>
	                        	交货日期
	                        </th>
	                        <td width="260px">
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_gath_date');" id="gath_start" name="gath_start" value="<c:out value="${gathStart}" />">
				            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('gath_start'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_gath_date\')');">
				            	<input type="hidden" id="hid_gath_start" value="<c:out value="${gathStart}" />">
				            	至
				            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_gath_date');" id="gath_end" name="gath_end" value="<c:out value="${gathEnd}" />">
				            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('gath_end'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_gath_date\')');">
				            	<input type="hidden" id="hid_gath_end" value="<c:out value="${gathEnd}" />">
	                    	</td>
	                    	<th class="c2" width="80px">
	                        	<input type="checkbox" name="cb_examine" id="cb_examine" <c:if test="${cbExamine=='1'}">checked="true"</c:if>>
	                        	审核状态
	                        </th>
	                    	<td class="c2" width="250px">
	                        	<input type="radio" name="examined" id="examine1" onClick="doAutoCheck('cb_examine');" <c:if test="${examined==null || examined=='' || examined=='Y'}">checked="true"</c:if>>已审核
	                        	<input type="radio" name="examined" id="examine2" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='N'}">checked="true"</c:if>>未审核
	                        	<input type="radio" name="examined" id="examine3" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='A'}">checked="true"</c:if>>全部
	                    	</td>
	                    	<th class="c3" width="80px">
			        			<input type="checkbox" name="cb_bb_code" id="cb_bb_code" <c:if test="${cbBbCode=='1'}">checked="true"</c:if>>
			        			业务单号
			        		</th>
			    			<td class="c3" width="180px">
			        			<input type="text" class="TextBox" maxlength="50" name="bb_code" id="bb_code" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bb_code');" value="${bbCode}" >
								<input type="hidden" id="hid_bb_code" value="<c:out value="${bbCode}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
	                        	<input type="checkbox" name="cb_est" id="cb_est" <c:if test="${cbEst=='1'}">checked="true"</c:if>>
	                        	外协商
	                        </th>
	                        <td class="c1">
	                        	<input type="text" class="TextBox" maxlength="50" name="est_name" id="est_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_est');" value="${estName}" >
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectEstName();" />
								<input type="hidden" id="hid_est_name" value="<c:out value="${estName}" />">
	                    	</td>
							<th class="c2">
	                        	<input type="checkbox" name="cb_gather" id="cb_gather" <c:if test="${cbGather=='1'}">checked="true"</c:if>>
	                        	收货状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="gather" id="gather1" onClick="doAutoCheck('cb_gather');" <c:if test="${gathered==null || gathered=='' || gathered=='Y'}">checked="true"</c:if>>已收完
								<input type="radio" name="gather" id="gather2" onClick="doAutoCheck('cb_gather');" <c:if test="${gathered=='P'}">checked="true"</c:if>>未收完
								<input type="radio" name="gather" id="gather3" onClick="doAutoCheck('cb_gather');" <c:if test="${gathered=='N'}">checked="true"</c:if>>未收货
								<input type="radio" name="gather" id="gather4" onClick="doAutoCheck('cb_gather');" <c:if test="${gathered=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_manager" id="cb_manager" <c:if test="${cbManager=='1'}">checked="true"</c:if>>
			        			业务员
			        		</th>
			    			<td class="c3">
			    				<input type="text" class="TextBox" maxlength="15" name="manager_name" id="manager_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_manager');" value="${managerName}" >
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('manager_name','cb_manager');" />
								<input type="hidden" id="hid_manager_name" value="<c:out value="${managerName}" />">
			    			</td>
			    		</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_lm" id="cb_lm" <c:if test="${cbLm=='1'}">checked="true"</c:if>>
			        			联系人
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="15" name="lm" id="lm" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_lm');" value="${lm}" >
								<input type="hidden" id="hid_lm" value="<c:out value="${lm}" />">
			    			</td>
			    			<th class="c2">
	                        	<input type="checkbox" name="cb_pay" id="cb_pay" <c:if test="${cbPay=='1'}">checked="true"</c:if>>
	                        	付款状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="paied" id="paied1" onClick="doAutoCheck('cb_pay');" <c:if test="${paied=='Y'}">checked="true"</c:if>>已付完
								<input type="radio" name="paied" id="paied2" onClick="doAutoCheck('cb_pay');" <c:if test="${paied=='N'}">checked="true"</c:if>>未付完
								<input type="radio" name="paied" id="paied3" onClick="doAutoCheck('cb_pay');" <c:if test="${paied==null || paied=='' || paied=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_creater" id="cb_creater" <c:if test="${cbCreater=='1'}">checked="true"</c:if>>
			        			开单人
			        		</th>
			    			<td class="c3">
			    				<input type="text" class="TextBox" maxlength="15" name="creater_name" id="creater_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_creater');" value="<c:out value="${createrName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('creater_name','cb_creater');" />
								<input type="hidden" id="hid_creater_name" value="<c:out value="${createrName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_phon" id="cb_phon" <c:if test="${cbPhon=='1'}">checked="true"</c:if>>
			        			电话
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="20" name="phon" id="phon" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_phon');" value="${phon}" >
								<input type="hidden" id="hid_phon" value="<c:out value="${phon}" />">
			    			</td>
							<th class="c2">
			        			<input type="checkbox" name="cb_make_type" id="cb_make_type" <c:if test="${cbMakeType=='1'}">checked="true"</c:if>>
			        			项目类型
			        		</th>
			        		<td class="c2">
			        			<select name="make_type" id="make_type" onFocus="doAutoCheck('cb_make_type');">
									<option value="0">==请选择==</option>
									<commonTag:createSelectTree list="${makeTypeList}" emptyOption="0" defaultValue="${makeType}" />
								</select>
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_dep" id="cb_dep" <c:if test="${cbDep=='1'}">checked="true"</c:if>>
			        			部门
			        		</th>
			    			<td class="c3">
			        			<select name="dep" id="dep" onFocus="doAutoCheck('cb_dep');">
	                            	<option value="0">==请选择==</option>
	                            	<commonTag:createSelectTree list="${depList}" emptyOption="0" defaultValue="${dep}" />
	                        	</select>
	                        </td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_bill_code" id="cb_bill_code" <c:if test="${cbBillCode=='1'}">checked="true"</c:if>>
			        			外协单号
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="bill_code" id="bill_code" onFocus="doAutoCheck('cb_bill_code');" onKeyUp="checkInput();" value="<c:out value="${billCode}" />">
								<input type="hidden" id="hid_bill_code" value="<c:out value="${billCode}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_prod" id="cb_prod" <c:if test="${cbProd=='1'}">checked="true"</c:if>>
			        			材质
			        		</th>
			        		<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="prod" id="prod" onFocus="doAutoCheck('cb_prod');" onKeyUp="checkInput();" value="<c:out value="${prod}" />">
								<input type="hidden" id="hid_prod" value="<c:out value="${prod}" />">
			    			</td>
			    			<th class="c3">&nbsp;</th>
			    			<td class="c3">&nbsp;</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_coo_cont" id="cb_coo_cont" <c:if test="${cbCooCont=='1'}">checked="true"</c:if>>
			        			摘要
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="coo_cont" id="coo_cont" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_coo_cont');" value="${cooCont}" >
								<input type="hidden" id="hid_coo_cont" value="<c:out value="${cooCont}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_content" id="cb_content" <c:if test="${cbContent=='1'}">checked="true"</c:if>>
			        			内容
			        		</th>
			        		<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="content" id="content" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_content');" value="${content}" >
								<input type="hidden" id="hid_content" value="<c:out value="${content}" />">
			    			</td>
			    			<th class="c3">&nbsp;</th>
			    			<td class="c3">&nbsp;</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_ts" id="cb_ts" <c:if test="${cbTs=='1'}">checked="true"</c:if>>
	                        	账套
			        		</th>
			    			<td class="c1">
			        			<select name="ts_id" id="ts_id" onFocus="doAutoCheck('cb_ts');">
				    				<option value="0">==请选择账套==</option>
				    				<c:forEach var="item" items="${tsList}">
									<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
									</c:forEach>
								</select>
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_require" id="cb_require" <c:if test="${cbRequire=='1'}">checked="true"</c:if>>
			        			制作要求
			        		</th>
			        		<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="require" id="require" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_require');" value="${require}" >
								<input type="hidden" id="hid_require" value="<c:out value="${require}" />">
			    			</td>
			    			<th class="c3">&nbsp;</th>
			    			<td class="c3">&nbsp;</td>
						</tr>
					</table>
			    	<div class="OptionOrderBy">
	                	<input type="checkbox" name="cb_order" id="cb_order" <c:if test="${cbOrder=='1'}">checked="true"</c:if>>
	                    	排序类型
	                    <select name="order_by" id="order_by" onFocus="doAutoCheck('cb_order');">
	                        <option value="">==请选择==</option>
					  		<option value="COOPER_DATE" <c:if test="${orderBy=='COOPER_DATE'}">selected</c:if>>外协日期</option>
					  		<option value="COST" <c:if test="${orderBy=='COST'}">selected</c:if>>金额</option>
					  		<option value="BILL_CODE" <c:if test="${orderBy=='BILL_CODE'}">selected</c:if>>单号</option>
					  		<option value="CONTENT" <c:if test="${orderBy=='CONTENT'}">selected</c:if>>摘要</option>
					  		<option value="EST_NAME" <c:if test="${orderBy=='EST_NAME'}">selected</c:if>>外协单位</option>
	                    </select>
	                    <select name="order_sc" id="order_sc" onFocus="doAutoCheck('cb_order');">
	                        <option value="ASC" <c:if test="${orderSc=='ASC'}">selected</c:if>>升序</option>
	                        <option value="DESC" <c:if test="${orderSc=='DESC'}">selected</c:if>>降序</option>
	                    </select>
	                    <span class="fr"><a href="javascript:;" id="lnkHiddenOption">隐藏查询选项</a></span>
	                </div>
			    </div>
			</div>
			
			<!-- 提示信息显示栏 -->
	        <div class="MsgBar">
	            <%@include file="../inc/AlertMsg.jsp"%>
	        </div>

			<!-- 上栏 分页、操作等 -->
			<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_TOTA;')==-1}">
	        <div class="TopToolBar">
	            <table class="ListNoteInfo" cellpadding="0" cellspacing="0">
	            	<tr>
	                	<td>
							<span>金额合计：${costTotal}元</span>
							<span>面积合计：${squareTotal}平方米</span>
							<span>长度合计：${lengMTotal}米&nbsp;${lengCmTotal}公分</span>
							<span>合同单数：${billTotal}笔</span>
	                	</td>
	            	</tr>
	            </table>
			</div>
			</c:if>
			

	      	<div class="table-list">
		        <table width="1800">
		          	<tr>
					  	<th  width="100">外协单号</th>
						<th  width="100">业务单号</th>
						<th  width="100">外协日期</th>
						<th  width="180">外协单位</th>
						<th  width="100">项目类型</th>
						<th  width="120">内容</th>
						<th  width="150">材质</th>
						<th  width="150">规格</th>
						<th  width="200">制作要求</th>
						<th  width="60">单位</th>
						<th  width="60">数量</th>
						<th  width="60">单价</th>
						<th  width="60">金额</th>
						<th  width="70">业务员</th>
						<th  width="70">开单人</th>
						<th  width="100">部门</th>
				  	</tr>
					<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" onClick='javascript:ClickCheck(this)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td>
							<input type="radio" name='query_checkbox' value="${item[2].cooperBillItem.id}" style="display:none">
							${item[0].cooperBill.billCode}
						</td>
						<td>${item[2].cooperBillItem.bbCode}</td>
						<td><fmt:formatDate value="${item[0].cooperBill.cooperDate}" pattern="yyyy-MM-dd"/></td>
						<td>${item[1]}</td>
						<td>${item[2].makeTypeName}</td>
						<td><commonTag:parseEnterToBr source="${item[2].cooperBillItem.finishedContent}" /></td>
						<td>${item[2].cooperBillItem.proName}</td>
						<td>
							<commonTag:parseEnterToBr source="${item[2].cooperBillItem.specification}" />
							<c:if test="${item[2].cooperBillItem.priceType=='AREA' || item[2].cooperBillItem.priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item[2].cooperBillItem.amount}" /></c:if>
						</td>
						<td><commonTag:parseEnterToBr source="${item[2].cooperBillItem.makeRequire}" /></td>
						<td>
							<c:if test="${item[2].cooperBillItem.priceType=='AREA'}">平方米</c:if>
							<c:if test="${item[2].cooperBillItem.priceType=='LENGTH'}">
								<c:if test="${item[2].cooperBillItem.lengType=='M'}">米</c:if><c:if test="${item[2].cooperBillItem.lengType=='CM'}">公分</c:if>
							</c:if>
							<c:if test="${item[2].cooperBillItem.priceType=='AMOUNT'}">${item[2].cooperBillItem.unit}</c:if>
						</td>
						<td>
							<c:if test="${item[2].cooperBillItem.priceType=='AREA' || item[2].cooperBillItem.priceType=='LENGTH'}"><commonTag:parseBigDecimal source="${item[2].cooperBillItem.squareNum}" /></c:if>
							<c:if test="${item[2].cooperBillItem.priceType=='AMOUNT'}"><commonTag:parseBigDecimal source="${item[2].cooperBillItem.amount}" /></c:if>
						</td>
						<td><commonTag:parseBigDecimal source="${item[2].cooperBillItem.unitPrice}" /></td>
						<td><commonTag:parseBigDecimal source="${item[2].cooperBillItem.cost}" /></td>
						<td>${item[0].cooperBill.managerName}</td>
						<td>${item[0].cooperBill.createrName}</td>
						<td>${item[0].departmentName}</td>
					</tr>
					</c:forEach>
				</table>
			</div>
			
			<!-- 底栏 分页、操作等 -->
	        <div class="BottomToolBar ClearFix">
			    <%@include file="../inc/Pages.jsp"%>
	        </div>
			
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	function ChangeWindowSize( container, maxWidth ){
	    setTimeout( function(){
	        var w1 = document.documentElement.clientWidth-40;
	        if( w1>maxWidth ) w1 = maxWidth;
	        else if( w1<970 ) w1 = 960;
	        container.style.width = w1+'px';
	    }, 300 );
	}
	var IsAdvSearch = false;
	(function(){
		doInit();
	    var ListContainer = document.getElementById('ListContainer');
	    ChangeWindowSize( ListContainer, 2020 );    // 超过 1280 的最大 1260 ，不全部铺满
	
	    var lnkMoreOption   = document.getElementById('lnkMoreOption');
	    var lnkHiddenOption = document.getElementById('lnkHiddenOption');
	    lnkMoreOption.onclick = function(){
	    	IsAdvSearch = true;
	        document.getElementById('dvMoreOptionBox').style.display = 'block';
	        document.getElementById('cb_cooper_date').style.visibility = 'visible';
	        this.style.visibility = 'hidden';
	    };
	    lnkHiddenOption.onclick = function(){
	    	IsAdvSearch = false;
	        document.getElementById('dvMoreOptionBox').style.display = 'none';
	        document.getElementById('cb_cooper_date').style.visibility = 'hidden';
	        lnkMoreOption.style.visibility = 'visible';
	    };
	})();
</script>
